package com.aiit.service.impl;

import com.aiit.dao.ADoctorDao;
import com.aiit.pojo.ADoctor;
import com.aiit.service.ADoctorService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ADoctorServiceImpl implements ADoctorService {

    @Resource
    private ADoctorDao adoctorDao;

    @Override
    public List<ADoctor> queryList() {
        return adoctorDao.queryList();
    }

    @Override
    public List<ADoctor> queryByKind(String kind) {
        return adoctorDao.queryByKind(kind);
    }

    @Override
    public ADoctor queryById(Integer id) {
        return this.adoctorDao.queryById(id);
    }

    @Override
    public List<ADoctor> queryAllByLimit(int offset, int limit) {
        return this.adoctorDao.queryAllByLimit(offset,limit);
    }

    @Override
    public ADoctor insert(ADoctor doctor) {
         this.adoctorDao.insert(doctor);
         return doctor;
    }

    @Override
    public ADoctor update(ADoctor doctor) {
        this.adoctorDao.update(doctor);
        return this.queryById(doctor.getId());
    }

    @Override
    public boolean deleteById(Integer id) {
        return this.adoctorDao.deleteById(id)>0;
    }
}
